package com.niit.user.web;

import com.niit.user.entity.User;
import com.niit.user.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author yaojianfeng
 */
@RestController
@RequestMapping("/message")
public class TestMessageController {
    @Autowired
    private MessageService messageService;

    @GetMapping("/rabbitmq/{channel}/{msg}")
    public String sendMessage(@PathVariable("channel") String channel, @PathVariable("msg") String msg) {
        return messageService.send(channel,msg);
    }

    @PostMapping("/rabbitmq/{channel}")
    public String sendPojoMessage(@PathVariable("channel") String channel, @RequestBody User user) {
        return messageService.send(channel,user);
    }

}
